import qs from 'qs'

var httptype = 'http'
var host = 'testm.gzl.cn'

var config = {
  api: {
    memberCenter: {
      getMemberInfo: httptype + '://' + host + '/app-web/native/member/getMemeberInfo.json',
      getSignInfo: httptype + '://' + host + '/app-web/native/sign/appsignInList.json',
      getIsSignIn: httptype + '://' + host + '/app-web/native/sign/isSignIn.json',
      signIn: httptype + '://' + host + '/app-web/native/sign/appSignIn.json',
      scoreInfo: httptype + '://' + host + '/app-web/native/points/myPoints.json',
      getCouponList: httptype + '://' + host + '/app-web/native/promoCode/list.json',
      getFreeCard: httptype + '://' + host + '/app-web/native/member/findCardByUserId.json',
      getUserInfo: httptype + '://' + host + '/app-web/native/member/myInformation.json',
      updateInfo: httptype + '://' + host + '/app-web/native/member/updateInformation.json',
      getMsgList: httptype + '://' + host + '/app-web/native/bussMessageLog/newFindMessageLogByUserId.json',
      getMyOrder: httptype + '://' + host + '/app-web/native/order/findOrderPage.json',
      getFindHobby: httptype + '://' + host + '/app-web/native/member/findHobby.json',
      readMessageLogById: httptype + '://' + host + '/app-web/native/bussMessageLog/readMessageLogById.json',
      getNoReadMessageNum: httptype + '://' + host + '/app-web/native/bussMessageLog/getNoReadMessageNum.json',
      saveHobby: httptype + '://' + host + '/app-web/native/member/saveHobby.json',
      isTripConsultantBind: httptype + '://' + host + '/app-web/native/member/findRecomCodeUsageByCustomerID.json',
      bindTravelConsultant: httptype + '://' + host + '/app-web/native/member/bindTravelConsultant.json',
      getUserByRecomCode: httptype + '://' + host + '/app-web/native/member/getUserByRecomCode.json',
      myCollection: httptype + '://' + host + '/app-web/native/member/userFavorites.json',
      queryCard: httptype + '://' + host + '/app-web/native/member/cardBalance.json'
    },
    Common: {
      picCode: httptype + '://' + host + '/app-web/ValidateCode'
    }
  },
  // accesstoken: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE4MjUwNjE4NTUsInBhc3N3b3JkIjoiZGM0ODNlODBhN2EwYmQ5ZWY3MWQ4Y2Y5NzM2NzM5MjQiLCJsb2dpbkFjY291bnQiOiIxMzY3ODk3NTg0MiJ9.3D5OMqrkhE6BBnNh8UK2MJYIpu4egqD9lqoTXPXFrSQ',
  accesstoken: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE4MjYwODc1MDAsInBhc3N3b3JkIjoiZGM0ODNlODBhN2EwYmQ5ZWY3MWQ4Y2Y5NzM2NzM5MjQiLCJsb2dpbkFjY291bnQiOiIxMzY3ODk3NTg0MiJ9.yhng3fMq6z7W3iFCLrKENPWUAnzgjR7LZDOdEcaBigE',
  userid: '1-POIUV4',
  memberid: 'ff8080815f71c3c2015f7515a6b2003e',
  footbar: [
    {name: '首页', icon: 'homepage-icon', ispick: false, url: '/'},
    {name: '行程', icon: 'trip-icon', ispick: false, url: '#'},
    {name: '支付', icon: 'pay-icon', ispick: false, url: '#'},
    {name: '我的', icon: 'my-icon', ispick: false, url: '/membercenter'}
  ],
  footbarpick: function (self, tabroute) {
    'use strict'
    for (var i = 0; i < this.footbar.length; i++) {
      self._data.footbar[i].ispick = false
    }
    switch (tabroute) {
      case '/':
        self._data.footbar[0].ispick = true
        self._data.footbarctl = true
        break
      case '/membercenter':
        self._data.footbar[3].ispick = true
        self._data.footbarctl = true
        break
      default:
        self._data.footbarctl = false
    }
  },
  productType: {
    SK: {en: 'SK', zh: '散客游'},
    DZ: {en: 'DZ', zh: '定制团'},
    YL: {en: 'YL', zh: '邮轮'},
    GZ: {en: 'GZ', zh: '固定自由行'},
    BZ: {en: 'BZ', zh: '半自由行'},
    WZ: {en: 'WZ', zh: '完全自由行'},
    JP: {en: 'JP', zh: '机票'},
    JD: {en: 'JD', zh: '酒店'},
    QZ: {en: 'QZ', zh: '签证'},
    PQ: {en: 'PQ', zh: '票劵'},
    TY: {en: 'TY', zh: '通用产品'},
    JJ: {en: 'JJ', zh: '机场建设费'},
    RY: {en: 'RY', zh: '燃油费'},
    HQ: {en: 'HQ', zh: '好巧网'},
    DY: {en: 'DY', zh: '导游服务费'},
    WF: {en: 'WF', zh: 'WiFi产品'},
    JF: {en: 'JF', zh: '积分商品'},
    ZC: {en: 'ZC', zh: '租车产品'}
  },
  getPicCode: function () {
    var randomVal = Math.random()
    var data = qs.stringify({ moblie: randomVal })
    var imgUrl = config.api.Common.picCode + '?' + data
    return imgUrl
  }
}

export default config
